define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'manageuser.user/index',
        add_url: 'manageuser.user/add',
        edit_url: 'manageuser.user/edit',
        delete_url: 'manageuser.user/delete',
        export_url: 'manageuser.user/export',
        modify_url: 'manageuser.user/modify',
        adopt_url: 'manageuser.user/adopt_url',
    };
    var Controller = {
        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    {field: 'id', title: 'ID', search: false},
                    {field: 'avatar', minWidth: 80, title: '头像', search: false, templet: ea.table.image},
                    {field: 'nickname', title: '用户昵称'},
                    {field: 'phone', title: '手机号'},
                    {field: 'gender', title: '性别',selectList: {0:'未知',1: '男',2:'女'}},
                    {field: 'is_merchant', title: '是否商户',selectList: {0:'否',1: '是'}},
                    {field: 'merchant_name', title: '商户名称'},
                    // {field: 'front_ofidcard', minWidth: 80, title: '身份证正面', search: false, templet: ea.table.image},
                    // {field: 'reverse_ofidcard', minWidth: 80, title: '身份证反面', search: false, templet: ea.table.image},
                    // {field: 'front_license', minWidth: 80, title: '驾驶证正面', search: false, templet: ea.table.image},
                    // {field: 'reverse_license', minWidth: 80, title: '驾驶证反面', search: false, templet: ea.table.image},

                    {field: 'status', title: '用户状态', templet: ea.table.switch, search: false},
                    {field: 'create_time', title: '注册时间', search: false},
                    {
                        width: 250,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            [
                                {
                                    text: '编辑',
                                    url: init.edit_url,
                                    method: 'open',
                                    auth: 'edit',
                                    class: 'layui-btn layui-btn-success layui-btn-xs',
                                    extend: 'data-full="true"',
                                }
                            ]
                        ]
                    }
                ]],
            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        binding_experts: function () {
            ea.listen();
        }
    };
    return Controller;
});